<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:p="http://primefaces.org/ui"
     template="../../Template.xhtml"
>
<ui:define name="title">Add GLN</ui:define>

<ui:define name="body">

<h:form>
	<p:panelGrid columns="2">
<h2>Add New </h2>
<p:commandButton value="Back" action="ManageGLN.xhtml" />
</p:panelGrid>
</h:form>
<br/><br/><br/><br/>
<h:form>

<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />

	<p:panelGrid columns="3">
	 
	 <p:outputLabel value="Select Country :" />
	   <p:selectOneMenu id="country" value="#{gLNMB.idC}" style="width:150px"  required="true" requiredMessage="please select a country" >
                <p:ajax listener="#{gLNMB.onCountryChange()}" update="State" />
                <f:selectItem itemLabel="Select Country" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{gLNMB.listPays}" var="a" itemValue="#{a.idPays}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
            <p:message for="country"/>
	
	  <p:outputLabel value="Select State :" />
	  <p:selectOneMenu id="State" value="#{gLNMB.idS}" style="width:150px"  required="true" requiredMessage="please select a state">
               <p:ajax listener="#{gLNMB.onStateChange()}" update="city" />
                 <f:selectItem itemLabel="Select State" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{gLNMB.listeEtat}"  var="s" itemValue="#{s.idEtat}"  itemLabel="#{s.intitule}"/>
            </p:selectOneMenu>
            <p:message for="State"/>
            
		<p:outputLabel value="Select City :"/>
		  <p:selectOneMenu id="city" value="#{gLNMB.idCi}" style="width:150px"  required="true" requiredMessage="City is required" >
                <f:selectItem itemLabel="Select city" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{gLNMB.listeVille}" var="a" itemValue="#{a.idVille}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
               <p:message for="city"/>
		
		<p:outputLabel value="GLN (Global Location Number)" />
		<p:inputText id="gln" value="#{gLNMB.gln.numero_GLN}" required="true" requiredMessage="Global Location Number is required"/>
		<p:message for="gln"/>
		
		<p:outputLabel value="Street" />
		<p:inputText id="Street" value="#{gLNMB.gln.rue_GLN}" required="true" requiredMessage="Street is required"/>
		<p:message for="Street"/>
		
		<p:outputLabel value="Select City :"/>
		  <p:selectOneMenu id="client" value="#{gLNMB.idClient}" style="width:150px"  required="true" requiredMessage="user is required" >
                <f:selectItem itemLabel="Select User" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{gLNMB.listeClient()}" var="a" itemValue="#{a.idUtilisateur}" itemLabel="#{a.username}" />
            </p:selectOneMenu>
               <p:message for="client"/>
		
		<p:outputLabel value="User :" />
		<p:selectOneMenu value="#{gLNMB.gln.statut}" >
			<f:selectItem  itemValue="true" itemLabel="Active"  />
			<f:selectItem  itemValue="false" itemLabel="Inactive"  />
		</p:selectOneMenu><br/>
		<p:commandButton action="#{gLNMB.Ajouter}" value="Add" ></p:commandButton>
	</p:panelGrid>
</h:form>
	
	
	
	
</ui:define>
</ui:composition>